<html>
<head><meta charset="utf-8"><title>improper C types and indirection · t-lang/wg-unsafe-code-guidelines · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/index.html">t-lang/wg-unsafe-code-guidelines</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/improper.20C.20types.20and.20indirection.html">improper C types and indirection</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="180540583"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/improper%20C%20types%20and%20indirection/near/180540583" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Henry-Mantilla <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/improper.20C.20types.20and.20indirection.html#180540583">(Nov 12 2019 at 17:34)</a>:</h4>
<p>Hey, I've updated <code>rustc</code> and compiling some FFI code now fires many <code>improper_ctypes</code> lints, which I find awesome and set up to <code>#[deny()]</code> by default. <strong>However, AFAIK, when <code>T : Sized</code>, a raw pointer or a rust reference to <code>T</code> is <code>#[repr(C)]</code>, independently of <code>T</code> so being. And yet the lint triggers on this case</strong>, which leads to having to have a <code>#[allow(improper_ctypes)]</code> added in such cases, which undermines the point of the lint, imho.</p>



<a name="180543150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/improper%20C%20types%20and%20indirection/near/180543150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/136281-t-lang/wg-unsafe-code-guidelines/topic/improper.20C.20types.20and.20indirection.html#180543150">(Nov 12 2019 at 18:02)</a>:</h4>
<p>See also <a href="https://github.com/rust-lang/rust/issues/66220" target="_blank" title="https://github.com/rust-lang/rust/issues/66220">#66220</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>